import 'package:flutter/material.dart';

// 计数器

class CounterRoute extends StatefulWidget {
  @override
  _CounterRoute createState() => new _CounterRoute();
}

class _CounterRoute extends State<CounterRoute> {
  // 点击次数
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("计数器"),
        ),
        body: Center(
          child: Column(
            children: <Widget>[
              new Text('$_counter',
                  style: Theme.of(context).textTheme.headline4),
            ],
          ),
        ),
        floatingActionButton: new FloatingActionButton(
            onPressed: _incrementCounter,
            tooltip: 'Increment',
            child: new Icon(Icons.add)));
  }
}
